package main

import (
"fmt"
"os"
"encoding/xml"
"io/ioutil"
)

type RecurlySevers struct{
	XMLName xml.Name `xml:"servers"`
	Version string   `xml:"version,attr"`
	Svs   []server   `xml:"server"`
	Description string `xml:",innerxml"`
}
type server struct {
	XMLName xml.Name `xml:"server"`
	ServerName string   `xml:"serverName"`
	ServerIp   string `xml:"serverIp"`
}

func main(){
	file, err := os.Open("server.xml")
	if err != nil {
		fmt.Printf("err :%v",err)
		return
	}
	defer file.Close()
	data ,err :=ioutil.ReadAll(file)
	if err != nil {
		fmt.Printf("err :%v",err)
		return
	}
	v := RecurlySevers{}
	err = xml.Unmarshal(data,&v)
	if err != nil {
		fmt.Printf("err :%v",err)
		return
	}
	
	fmt.Println(v)
	//sleep(1000)
}
